home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  2.2 KB  |  81 lines

  1. /* Debugging aids -- togglable assertions.
  2.    Copyright (C) 1994 Free Software Foundation, Inc.
  3.  
  4. This file is part of XEmacs.
  5.  
  6. XEmacs is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option) any
  9. later version.
  10.  
  11. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14. for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with XEmacs; see the file COPYING.  If not, write to the Free
  18. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* Synched up with: Not in FSF. */
  21.  
  22. /* Written by Chuck Thompson */
  23.  
  24. #ifndef _XEMACS_DEBUG_H_
  25. #define _XEMACS_DEBUG_H_
  26.  
  27. #define DEBUG_STDERR    1
  28. #define DEBUG_ABORT    2
  29.  
  30. #ifdef DEBUG_XEMACS
  31.  
  32. #include <stdio.h>
  33.  
  34. struct debug_classes
  35. {
  36.   unsigned int redisplay :1;
  37.   unsigned int buffers :1;
  38.   unsigned int extents :1;
  39.   unsigned int faces :1;
  40.   unsigned int windows :1;
  41.   unsigned int frames :1;
  42.   unsigned int devices :1;
  43.   unsigned int bytecode :1;
  44.  
  45.   unsigned int types_of_redisplay;
  46.   unsigned int types_of_buffers;
  47.   unsigned int types_of_extents;
  48.   unsigned int types_of_faces;
  49.   unsigned int types_of_windows;
  50.   unsigned int types_of_frames;
  51.   unsigned int types_of_devices;
  52.   unsigned int types_of_bytecode;
  53. };
  54.  
  55. extern Lisp_Object Qredisplay, Qbuffers, Qextents, Qfaces;
  56. extern Lisp_Object Qwindows, Qframes, Qdevices, Qbytecode;
  57. extern struct debug_classes active_debug_classes;
  58.  
  59. #define DASSERT(class, desired_type, action, assertion) do        \
  60. {                                    \
  61.   if (active_debug_classes.##class                    \
  62.       && (active_debug_classes.types_of_##class & desired_type))    \
  63.     {                                    \
  64.       if (! (assertion))                        \
  65.     {                                \
  66.       if (action == DEBUG_STDERR)                    \
  67.         stderr_out ("Assertion failed in %s at line %d\n",        \
  68.             __FILE__, __LINE__);                       \
  69.       else                                \
  70.         abort ();                            \
  71.     }                                \
  72.     }                                    \
  73. } while (0)
  74. #else /* !DEBUG_XEMACS */
  75.  
  76. #define DASSERT(class, desired_type, action, assertion)    ((void) 0)
  77.  
  78. #endif /* !DEBUG_XEMACS */
  79.  
  80. #endif /* _XEMACS_DEBUG_H_ */
  81.